home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1995 January / macformat-020.iso / Shareware City / Applications / Alpha.5.96 folder / Tcl / SystemCode / help.tcl < prev    next >
Encoding:
Text File  |  1994-09-17  |  1.2 KB  |  54 lines  |  [TEXT/ALFA]

  1.  
  2.  
  3.  
  4. proc procDefinition {} {
  5.     global auto_index auto_help 
  6.  
  7.     watchCursor
  8.     set wins [llength [winNames]]
  9.     if {!$wins || ![string length [set res [getSelect]]]} {
  10.         helpDummy
  11.         set res [listpick -p {Proc?} [set procdefs [lsort -ignore [concat [array names auto_index] [array names auto_help]]]]]
  12.     }
  13.     if {$wins} {select [getPos]}
  14.     if {[string length $res]} {
  15.         if {[catch {set fname $auto_index($res)}]} {
  16.             helpDummy
  17.             if {[catch {set res $auto_help($res)}]} {
  18.                 message "No such proc."
  19.                 return;
  20.             }
  21.             regexp {[^/]*} $res fname
  22.             regexp {/(.*)} $res dummy pos
  23.         }
  24.         if {[expr {[lsearch [winNames -f] "*$fname"] >= 0}]} {
  25.             bringToFront $fname
  26.         } elseif {[file exists $fname]} {
  27.             if {[info exists pos]} {
  28.                 edit -r $fname
  29.             } else {
  30.                 edit $fname
  31.             }
  32.         } else {
  33.             alertnote "File \" $fname \" not found." ; return
  34.         }
  35.         
  36.         if {![info exists pos]} {
  37.             set pos [lindex [search -f 1 -r 1 -i 0 "^proc\[ \t\]+$res " 0] 0]
  38.         }
  39.         display $pos
  40.     }
  41. }
  42.  
  43. proc dumpHelpMarks {} {
  44.     set blah "proc helpDummy {} {}\r"
  45.     
  46.     foreach m [getNamedMarks] {
  47.         append blah "set auto_help([lindex $m 0]) \"\$HOME:Help:[file tail [lindex $m 1]]/[lindex $m 3]\"\r"
  48.     }
  49.     new
  50.     insertText $blah
  51. }
  52.  
  53. #================================================================================
  54.